export const formatDateTimeWithTimestamp = (dateTimeStr) => {
    // 将字符串转换为时间戳
    const timestamp = new Date(dateTimeStr).getTime();

    // 将时间戳转换回日期对象
    const date = new Date(timestamp);

    // 提取年月日时分
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
    const day = String(date.getDate()).padStart(2, '0');
    const hours = String(date.getHours()).padStart(2, '0');
    const minutes = String(date.getMinutes()).padStart(2, '0');

    // 组合成需要的格式
    return `${year}-${month}-${day} ${hours}:${minutes}`;
}
export const getCurrentDateTime = () => {
    const now = new Date();
    const year = now.getFullYear();
    const month = String(now.getMonth() + 1).padStart(2, '0');
    const day = String(now.getDate()).padStart(2, '0');
    const hours = String(now.getHours()).padStart(2, '0');
    const minutes = String(now.getMinutes()).padStart(2, '0');

    return `${year}-${month}-${day} ${hours}:${minutes}`;
}

export const setChatTime = (time, modeTime) => {
    if (time === undefined || time === null || time == '' || time == 0) {
        return (modeTime / 1000).toFixed(2);
    }
    return (time / 1000).toFixed(2);

}